package cn.edu.javaweb.adminServlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.javaweb.service.AdminAddNewsService;
import cn.edu.javaweb.utils.DBUtil;

/**
 * Servlet implementation class AddNews
 */
@WebServlet("/AddNews")
public class AddNews extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	private AdminAddNewsService add=new AdminAddNewsService();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doPost(request, response);
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String title=request.getParameter("title");
		String pricture=request.getParameter("pricture");
		String content=request.getParameter("content");
		int result=add.getAdd(title, pricture, content);
		PrintWriter out=response.getWriter();
		response.sendRedirect("/Volunteer/News");
		
	}


}
